﻿namespace EyeOpen.DataDriven.Web
{
    using System;
    using System.Web.UI.WebControls;

    public partial class _Default : System.Web.UI.Page
    {
        protected override void OnLoad(EventArgs e)
        {
            if ((!this.IsPostBack) && (this.personListGridView.Rows.Count > 0))
            {
                this.personListGridView.SelectedIndex = 0;
            }
        }

        protected void PersonListGridView_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.personDetailsView.ChangeMode(DetailsViewMode.Edit);
        }

        protected void PersonListGridView_RowDeleted(object sender, GridViewDeletedEventArgs e)
        {
            this.personDetailsView.DataBind();
        }

        protected void PersonDetailsView_DataBound(object sender, EventArgs e)
        {
            this.personDetailsView.Fields[0].Visible = false;
        }

        protected void PersonDetailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
        {
            this.personListGridView.DataBind();
        }

        protected void PersonDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
        {
            this.personListGridView.DataBind();
        }
    }
}